import apibase from "@/api/apiBase";
import axios from "axios";
import {
  grantInterface,
  delInterface,
  addInterface,
  detailInterface,
  changeStatusInterface,
  listInterface,
  editInterface,
  roleAdminListInterface,
  cancelInterface,
  notRoleAdminListInterface,
} from "./role.interface";
//角色授权用户
export const $roleGrant = (params: grantInterface) => {
  const $server = new apibase();
  const instance = axios.create();
  return $server.post({
    url: '/travel/role/grant',
    data: params,
    instance,
  });
}
//删除角色
export const $roleDel = (params: delInterface) => {
  const $server = new apibase();
  const instance = axios.create();
  return $server.post({
    url: '/travel/role/del',
    data: params,
    instance,
  });
}
//新增角色
export const $roleAdd = (params: addInterface) => {
  const $server = new apibase();
  const instance = axios.create();
  return $server.post({
    url: '/travel/role/add',
    data: params,
    instance,
  });
}
//角色详情
export const $roleDetail = (params: detailInterface) => {
  const $server = new apibase();
  const instance = axios.create();
  return $server.get({
    url: '/travel/role/detail',
    data: params,
    instance,
  });
}
//角色列表
export const $roleChangeStatus = (params: changeStatusInterface) => {
  const $server = new apibase();
  const instance = axios.create();
  return $server.post({
    url: '/travel/role/change_status',
    data: params,
    instance,
  });
}
//角色列表
export const $roleList = (params: listInterface) => {
  const $server = new apibase();
  const instance = axios.create();
  return $server.get({
    url: '/travel/role/list',
    data: params,
    instance,
  });
}
//编辑角色
export const $roleEdit = (params: editInterface) => {
  const $server = new apibase();
  const instance = axios.create();
  return $server.post({
    url: '/travel/role/edit',
    data: params,
    instance,
  });
}

//角色用户列表
export const $roleAdminList = (params: roleAdminListInterface) => {
  const $server = new apibase();
  const instance = axios.create();
  return $server.get({
    url: '/travel/role/roleAdminList',
    data: params,
    instance,
  });
}

//角色取消授权用户
export const $roleCancel = (params: cancelInterface) => {
  const $server = new apibase();
  const instance = axios.create();
  return $server.post({
    url: '/travel/role/cancel',
    data: params,
    instance,
  });
}

//非角色用户列表
export const $notRoleAdminList = (params: notRoleAdminListInterface) => {
  const $server = new apibase();
  const instance = axios.create();
  return $server.get({
    url: '/travel/role/notRoleAdminList',
    data: params,
    instance,
  });
}